﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace igflow
{
    public class Camera : GameObject.igGameObject
    {
        Components.igCamera camera;
        //public Vector3 Offset = Vector3.Zero;
        public Camera(float FOV, float aspect ,float near, float far , bool orthgraphic)
        {
            camera = new igflow.Components.igCamera();
            camera.FOV = FOV;
            camera.aspect = aspect;
            camera.near = near;
            camera.far = far;
            camera.isOrthographic = orthgraphic;
            AddComponent(camera);
        }

        public Matrix View
        {
            get { return camera.View; }
        }

        public Matrix Projection
        {
            get { return camera.Projection; }
        }

        public void SetOffset(Vector3 newOffset)
        {
            if (camera.DesiredFocusOffset != newOffset)
            {
                camera.DesiredFocusOffset = newOffset;
            }
        }

        public void SetTarget(Vector3 newTarget)
        {
            if (camera.DesiredTargetPosition != newTarget)
            {
                camera.DesiredTargetPosition = newTarget;
            }
        }

        internal void SetPosition(Vector3 newPos)
        {
            if (camera.DesiredPosition != newPos)
            {
                camera.DesiredPosition = newPos;
            }
        }
    }
}
